package com.yuandian.utils.poi.converter;

import com.alibaba.excel.converters.Converter;
import com.alibaba.excel.enums.CellDataTypeEnum;
import com.alibaba.excel.metadata.GlobalConfiguration;
import com.alibaba.excel.metadata.data.CellData;
import com.alibaba.excel.metadata.property.ExcelContentProperty;

/**
 * 说明：告警类型转换器
 * @Author yanjun
 * @Date 2020/12/25 17:11
 */
public class AlarmLevelConverter implements Converter<Integer> {

    /**
     * java类型
     * @return
     */
    @Override
    public Class supportJavaTypeKey() {
        return Integer.class;
    }

    /**
     * excel类型
     * @return
     */
    @Override
    public CellDataTypeEnum supportExcelTypeKey() {
        return CellDataTypeEnum.STRING;
    }

    /**
     * 读时调用
     * @param cellData
     * @param excelContentProperty
     * @param globalConfiguration
     * @return
     * @throws Exception
     */
//    @Override
//    public Integer convertToJavaData(CellData cellData, ExcelContentProperty excelContentProperty,
//                                     GlobalConfiguration globalConfiguration) throws Exception {
//        return null;
//    }

    /**
     * 写时调用
     * @param val
     * @param excelContentProperty
     * @param globalConfiguration
     * @return
     * @throws Exception
     */
//    @Override
//    public CellData convertToExcelData(Integer val, ExcelContentProperty excelContentProperty,
//                                       GlobalConfiguration globalConfiguration) throws Exception {
//        if (val == 1) {
//            return new CellData("提示");
//        } else if (val == 2) {
//            return new CellData("一般");
//        } else if (val == 3) {
//            return new CellData("重大");
//        } else if (val == 4) {
//            return new CellData("紧急");
//        } else if (val == 5) {
//            return new CellData("正常");
//        }
//        return new CellData("");
//    }
}
